/******************************************************************************/
//	ObjectBase.h	-	Provides base functionality for all objects
/******************************************************************************/

#ifndef _OBJECTBASE_H_
#define _OBJECTBASE_H_

#include "event.h"

class CObjectBase
{
	private:

		int m_nObjectId;	//	A unique id for this object (assigned in constructor).
							//	Relevant Functions: GetId

		int m_nFlags;		//	Defines the properties associated with this object
							//  Relevant Functions: RemoveMask, AddMask, AreFlagsSet

	public:

		enum ObjectBaseMask
		{
			MASK_ENTITY			= 1<<0,  // indicates this object is an entity
			MASK_MANAGER		= 1<<1,  // indicates this object is a manager
			MASK_PAUSED			= 3<<2,	 // indicates this object should not receive an update
		};

		// contructor
		CObjectBase();

		// destructor
		virtual ~CObjectBase();
		
		/******************************************************************************/
		//	Init	-	Initializes Object
		/******************************************************************************/
		virtual	void	Init()	=	0;

		/******************************************************************************/
		//	Update	-	Updates Objects
		//
		//	Return:	TRUE if successful
		/******************************************************************************/
		virtual	bool	Update()	=	0;

		/******************************************************************************/
		//	Shutdown	-	Shutdown the Object
		/******************************************************************************/
		virtual void	Shutdown()	=	0;

		/******************************************************************************/
		//	RemoveFlags	-	Turn off a property mask for this object
		//
		//	In:		nMask	-	The mask to remove from the object
		//							(see ObjectBaseMask enum for possible values)
		/******************************************************************************/
		void RemoveFlags(int nMask);

		/******************************************************************************/
		//	AddFlags	-	Turn on a property mask for this object
		//
		//	In:		nMask	-	The mask to add to the object
		//							(see ObjectBaseMask enum for possible values)
		/******************************************************************************/
		void AddFlags(int nMask);

		/******************************************************************************/
		//	AreFlagsSet	-	Check if a particular property mask is turned on
		//
		//	In:		nMask	-	The mask to check
		//							(see ObjectBaseMask enum for possible values)
		//
		//	Return:	true if the mask is on, false otherwise
		/******************************************************************************/
		bool AreFlagsSet(int nMask);

		/******************************************************************************/
		//	EnQueueEvent	-	Processes events passed to this object
		//
		//	In:		pEvent	-	pointer to the event this object should process.
		//											(See Event class for more info)
		//
		//	Return:	true if successfully processed, false otherwise
		//
		//	Note:	This function is meant to be overridden by its children
		/******************************************************************************/
		virtual bool EnQueueEvent(Event* pEvent);

		/*************/
		/* ACCESSORS */

		// GetId	- returns the unique id of this object
		int GetId()	{	return m_nObjectId;	}	

};

#endif // _OBJECTBASE_H_


